﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Client_Server_Interface
{
    public class ErrorListRecord
    {
        public enum RecordState
        {
            Add,
            Delete,
            Seen,
            Old
        }

        public string Region { get; set; }
        public string Station { get; set; }
        public string Device { get; set; }
        public string Status { get; set; }
        public string Info { get; set; }
        public DateTime Date { get; set; }
        public RecordState State { get; set; }

        public override int GetHashCode()
        {
            return Region.GetHashCode() ^ Station.GetHashCode() ^ Device.GetHashCode() ^ Info.GetHashCode() ^
                   Status.GetHashCode() ^ Date.GetHashCode();
        }

        public int GetRecordId()
        {
            return Region.GetHashCode() ^ Station.GetHashCode() ^ Device.GetHashCode() ^ Info.GetHashCode() ^
                   Status.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return false;
            }

            // If parameter cannot be cast to Point return false.
            var p = obj as ErrorListRecord;
            if (p == null)
            {
                return false;
            }

            // Return true if the fields match:
            return GetHashCode() == p.GetHashCode();
        }
    }

    public static class ErrorStatus
    {
        public const string CRITICAL = "Critical";
        public const string ALARM = "Alarm";
        public const string WARNING = "Warning";
        public const string MINOR = "Minor";
        public const string INDETERMINATE = "Indeterminate";
    }
}
